inPath = '../blueblackExamples';
outPath = '../blueBlackPlots';
cateName = cell(6,1);
cateName{1} = 'black_bumper';
cateName{2} = 'black_hood';
cateName{3} = 'black_roof';
cateName{4} = 'blue_bumper';
cateName{5} = 'blue_roof';
cateName{6} = 'blue_hood';

dataVec = cell(2,1);
blueVec = [];
blackVec=[];
for iFolder = 1:3
    curr_folder = fullfile(inPath,cateName{iFolder});
    files = dir(fullfile(curr_folder,'*.png'));
    folderVec=[];
    for iFile = 1:length(files)
        img = imread(fullfile(curr_folder,files(iFile).name));
        folderVec = [folderVec; reshape(img,[],3)];
    end
    folderVec = im2single(folderVec);
    
    dataVec{iFolder}=folderVec;
    blackVec =[blackVec; folderVec;];
end
for iFolder = 3:6
    curr_folder = fullfile(inPath,cateName{iFolder});
    files = dir(fullfile(curr_folder,'*.png'));
    folderVec=[];
    for iFile = 1:length(files)
        img = imread(fullfile(curr_folder,files(iFile).name));
        folderVec = [folderVec; reshape(img,[],3)];
    end
    folderVec = im2single(folderVec);
    dataVec{iFolder}=folderVec;
    blueVec =[blackVec; folderVec;];
end

for iFolder = 1:length(cateName)
    data = dataVec{iFolder};
    scatter3(data(:,1),data(:,2),data(:,3),5+ones(size(data,1),1),data,'filled');
        xlabel('R Value');xlim([0 1]);
    ylabel('G Value');ylim([0 1]);
    zlabel('B Value');zlim([0 1]);
    title(cateName{iFolder})
    view(-60,60);
    saveas(gcf,fullfile(outPath,[cateName{iFolder} 'view1.png']));
    view(40,35);
    saveas(gcf,fullfile(outPath,[cateName{iFolder} 'view2.png']));
    close;
end

 data = blueVec;
 scatter3(data(:,1),data(:,2),data(:,3),5+ones(size(data,1),1),data);
        xlabel('R Value');xlim([0 1]);
    ylabel('G Value');ylim([0 1]);
    zlabel('B Value');zlim([0 1]);
    title(cateName{iFolder})
    view(-60,60);
    saveas(gcf,fullfile(outPath,[ 'Blue_overall_view1.png']));
    view(40,35);
    saveas(gcf,fullfile(outPath,['Blue_overall_view2.png']));
    close;
    
 data = blackVec;
 scatter3(data(:,1),data(:,2),data(:,3),5+ones(size(data,1),1),data);
 xlabel('R Value');xlim([0 1]);
 ylabel('G Value');ylim([0 1]);
 zlabel('B Value');zlim([0 1]);
 title(cateName{iFolder})
 view(-60,60);
 saveas(gcf,fullfile(outPath,[ 'Black_overall_view1.png']));
 view(40,35);
 saveas(gcf,fullfile(outPath,['Black_overall_view2.png']));
 close;
    
